
/* ======== 全局样式 ======== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #ffe5d1, #f4f5fb 40%, #e6ecff);
  color: #222;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 1100px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
  padding: 20px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

/* ======== 头部 ======== */
.header {
  text-align: center;
  padding: 12px 0 8px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #d4380d;
  letter-spacing: 1px;
}

.subtitle {
  font-size: 15px;
  color: #666;
  margin-top: 6px;
}

/* ======== 游戏容器 ======== */
.game-container {
  display: flex;
  gap: 24px;
  min-height: 500px;
}

/* ======== 卡片区域 ======== */
.cards-section {
  flex: 1;
  background: #fafbfc;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e8e8e8;
}

.cards-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #333;
  font-weight: 600;
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
}

/* 卡片样式 */
.event-card {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
  cursor: grab;
  transition: all 0.3s ease;
  user-select: none;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-color: #d4380d;
}

.event-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
  cursor: grabbing;
}

.event-card .card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.event-card .card-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

/* ======== 时间轴区域 ======== */
.timeline-section {
  flex: 1.5;
  background: #fafbfc;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e8e8e8;
}

.timeline-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #333;
  font-weight: 600;
}

.timeline-container {
  position: relative;
  padding-left: 40px;
}

/* 时间轴线 */
.timeline-container::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, #d4380d, #ff7a45);
  border-radius: 2px;
}

/* 时间轴项目 */
.timeline-item {
  position: relative;
  margin-bottom: 40px;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -32px;
  top: 8px;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 3px solid #d4380d;
  border-radius: 50%;
  z-index: 2;
}

.timeline-year {
  font-size: 18px;
  font-weight: 700;
  color: #d4380d;
  margin-bottom: 8px;
}

.timeline-content {
  background: #fff;
  border: 2px dashed #e9ecef;
  border-radius: 12px;
  padding: 16px;
  min-height: 80px;
  transition: all 0.3s ease;
  position: relative;
}

.timeline-content.drag-over {
  border-color: #d4380d;
  background: #fff5f0;
  transform: scale(1.02);
}

.timeline-content.correct {
  border-color: #52c41a;
  background: #f6ffed;
}

.timeline-content.incorrect {
  border-color: #ff4d4f;
  background: #fff1f0;
}

.timeline-content .placed-card {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  cursor: default;
}

.timeline-content .placed-card:hover {
  transform: none;
  box-shadow: none;
}

/* ======== 控制区域 ======== */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid #e8e8e8;
}

.stats {
  display: flex;
  gap: 24px;
  font-size: 16px;
  color: #333;
}

.stats span {
  font-weight: 600;
}

.reset-btn {
  background: linear-gradient(135deg, #d4380d 0%, #ff7a45 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(212, 56, 13, 0.3);
}

.reset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 56, 13, 0.4);
}

/* ======== 响应式设计 ======== */
@media (max-width: 768px) {
  .app {
    padding: 16px;
    margin: 8px;
  }

  .header h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 14px;
  }

  .game-container {
    flex-direction: column;
    gap: 20px;
  }

  .cards-section,
  .timeline-section {
    padding: 16px;
  }

  .controls {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .stats {
    justify-content: center;
  }
}

/* ======== 动画效果 ======== */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.event-card,
.timeline-item {
  animation: slideIn 0.5s ease-out;
}

/* ======== 拖拽时的视觉反馈 ======== */
.drag-placeholder {
  background: rgba(212, 56, 13, 0.1);
  border: 2px dashed #d4380d;
  border-radius: 12px;
  height: 80px;
  margin: 8px 0;
}
